{% extends "base.html" %}

{% block content %}
  <script type="text/javascript">
    window.onload=function() {
      document.add_new_message.message.focus();
    }
  </script>
  <center>
  {% if is_admin %}
    {% if error_message %}
      <div class="error">
      {{ error_message }}
      </div>
    {% endif %}
    <form action="/" name="add_new_message" method="post">
      <input type="text" size="80" name="message" value="">
      <input type="hidden" name="last_status_key" value="{{ last_status_key }}">
      <input type="submit" name="change" value="Change">
      <input type="button" name="refresh" value="Refresh" onclick="location.href='/';">
      <input type="button" name="history" value="History" onclick="location.href='/allstatus';">
    </form>
  {% endif %}
  <br><br>
  <h2>Last {{ default_status_chunk }} {{ title }}</h2>
  <table border="1" cellpadding="5">
  <tr bgcolor="#CCCCFF">
    <td><b>Who</b></td>
    <td><b>When</b></td>
    <td><b>Message</b></td>
    <td><b>Revs committed</b></td>
  </tr>
  {% for a_status in status %}
    <tr class="{{ a_status.general_state }}">
      <td>{{ a_status.username }}</td>
      <td>{{ a_status.date|date:"D M d, H:i T " }}</td>
      <td>{{ a_status.message }}</td>
      <td>
        {% if a_status.codesite_changes_url %}
          <a href='{{ a_status.codesite_changes_url }}'>
            r{{ a_status.first_rev }}
            {% if a_status.last_rev %}
              {% if a_status.last_rev != a_status.first_rev %}
                - r{{ a_status.last_rev }}
              {% endif %}
            {% else %}
              +
            {% endif %}
          </a>
        {% else %}
          None
        {% endif %}
      </td>
    </tr>
  {% endfor %}

  </table>
  </center>
{% endblock %}
